home *** CD-ROM | disk | FTP | other *** search
- Path: access1.digex.net!not-for-mail
- From: ell@access1.digex.net (Ell)
- Newsgroups: comp.lang.c++
- Subject: Re: cin.get(string) problem
- Date: 11 Feb 1996 22:12:46 GMT
- Organization: The Universe
- Message-ID: <4flpku$r7e@news4.digex.net>
- References: <4fk7e5$j9h@cloner3.netcom.com>
- NNTP-Posting-Host: access1.digex.net
- X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
-
- Manuel Hernandez (ManuelHe@ix.netcom.com) wrote:
- : greinerk@ix.netcom.com (Kurt W. Greiner) writes:
- : > Hi all,
- : > i was trying some really simple io for a program that just gets
- : > values, here is a sample of code
- : >
- : > #include <iostream.h>
- : >
- : > void main(void)
- : > {
- : > char string[80];
- : > cin.get(string,sizeof(string));
- : > cin.get(string,sizeof(string));
- : > }
- : >
- : > ok, say i want to read in a name on the first cin, i type in "john smith" and
- : > the prompt, john gets thrown in to the first and smith the second, i do not
- : > even get prompted for the second cin. it does not happen if i type in a string
- : > with out spaces. i am using borland c++ 2.0, am i doing something wrong or is
- : > there an other way of doing this other than gets(string)?
- : >...
-
- Right, I find that getline() works better than get() in most cases.
-
- Elliott
-